#!/bin/sh
set -ex

apt-get update
apt-get install --yes \
  ca-certificates \
  curl

# Install azure-health-exporter
useradd -r -d /opt/azure-health-exporter ahe

mkdir -p /opt/azure-health-exporter
mv /azure-health-exporter /opt/azure-health-exporter

chown -R ahe /opt/azure-health-exporter

# Clean
apt-get remove --purge curl --yes
apt-get autoremove --purge --yes
apt-get clean --yes

# CIS Benchmarking
sed -i 's/^PASS_MAX_DAYS.*$/PASS_MAX_DAYS   60/g' /etc/login.defs
sed -i 's/^PASS_MIN_DAYS.*$/PASS_MIN_DAYS   7/g' /etc/login.defs
sed -i 's/^UMASK.*$/UMASK   027/g' /etc/login.defs
